 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>冒泡排序</title>
</head>
<body>
    <script>
        var sz=[5,4,3,2,1];
        var mp=0;
        var zh="";
        for(var i=0;i<sz.length;i++)
        {
            for(var j=i;j<sz.length;j++)
            {
                if(sz[i]>=sz[j])
                {
                    mp=sz[i];
                    sz[i]=sz[j];
                    sz[j]=mp;
                }
            }
            zh=zh+sz[i]+",";
        }
        console.log(zh.substring(0,zh.length-1));
    </script>
     <p align="center"> 按ctrl+shift+i查看源代码</p>
</body>
</html>